﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Abp.Application.Services;
using FwProject.Core.Restaurant;
using FwProject.Distribution.Dto;
using FwProject.Restaurant.Dto;
using Microsoft.AspNetCore.Mvc;
using X.PagedList;

namespace FwProject.Restaurant
{
    public interface ILoadCarAppService: IApplicationService
    {

        /// <summary>
        /// 修改界面
        /// </summary>
        /// <returns>The create.</returns>
        /// <param name="input">Input.</param>
        Task<Guid> EditLoadCar(LoadEditCarDto input);

        /// <summary>
        /// 获取装车的修改数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>

        Task<LoadCarOutputDto> GetLoadCarInfo(Guid id);
        /// <summary>
        /// 库管退回重新装车
        /// </summary>
        /// <returns>The create.</returns>
        /// <param name="input">Input.</param>
        [HttpGet]
        Task BackLoadCarStatus(Guid Id);

        Task<List<LoadCarExportDto>> GetLoadingInvoiceListAsync(LoadInvoiceFilter filter = null);
        /// <summary>
        /// 添加一个装车信息
        /// </summary>
        /// <returns>The create.</returns>
        /// <param name="input">Input.</param>
        Task<Guid> Create(LoadCarInputDto input);
        /// <summary>
        /// 添加一个具体的装车信息
        /// </summary>
        /// <returns>The load car.</returns>
        /// <param name="id">汽车id</param>
        /// <param name="input">Input.</param>
        Task CreateLoadCar(Guid id, LoadCarInputDto inputt);

        Task CreateLoadCarAndDistribution(DistributionInpuDto input, long driverId);
        /// <summary>
        /// 修改装车信息
        /// </summary>
        /// <returns>The create.</returns>
        /// <param name="input">Input.</param>
        Task Update(Guid id, LoadCarInputDto input);

        Task UpdateType(Guid id, LoadCarTypesEnterDto input);
        /// <summary>
        /// 返回装车信息
        /// </summary>
        /// <returns>The by identifier async.</returns>
        /// <param name="id">Identifier.</param>
        [HttpGet]
        Task<LoadCarDto> GetByIdAsync(Guid id);

        /// <summary>
        /// 返回当前的装车数据默认子返回一条数据
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        Task<Tuple<bool, LoadCarDto, LoadCarDto>> GetLoadCarInfoByAsync();

        Task<CarShopInfo> GetByNowCarInfoAsync();

        [HttpPost]
        /// <summary>
        /// 装车状态修改
        /// </summary>
        /// <returns>The status.</returns>
        /// <param name="id">Identifier.</param>
        /// <param name="status">Status.</param>
        Task EditStatus(LoadCarUpdate loadCarInfo);

        /// <summary>
        /// 库管出库审核
        /// </summary>
        /// <param name="loadCarInfo"></param>
        /// <returns></returns>
        Task EditAndCarLoadIngStatus(List<LoadingCarUpdateInput> loadCarInfo);

        /// <summary>
        /// 后台装车出库审核
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task UpdateStatus(Guid id, ExamineStatus examine);

        [HttpGet]
        Task<X.PagedList.IPagedList<LoadCarDto>> GetPagedListAsync(int pageIdx, int pageSize, DateTime? begindateTime, DateTime? enddatetime);

        /// <summary>
        /// 库管人员获取出库审核中的所有装车信息条件是根据当前的工厂
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        Task<X.PagedList.IPagedList<LoadCarDto>> GetPagedStatusListAsync(int pageIdx,int pageSize);
        /// <summary>
        /// 回库审核中
        /// </summary>
        /// <param name="pageIdx"></param>
        /// <param name="pageSize"></param>
        /// <param name="carStatus"></param>
        /// <param name="begindateTime"></param>
        /// <param name="enddatetime"></param>
        /// <returns></returns>
        [HttpGet]
        Task<List<CarShopInfo>> GetLoadCarPagedListAsync(int pageIdx, int pageSize, CarStatus carStatus, DateTime? begindateTime, DateTime? enddatetime);
        /// <summary>
        /// 装车审核
        /// </summary>
        /// <param name="pageIdx"></param>
        /// <param name="pageSize"></param>
        /// <param name="begindateTime"></param>
        /// <param name="enddatetime"></param>
        /// <returns></returns>
        [HttpGet]
        Task<IPagedList<LoadCarDto>> GetByOneLoadCarPagedListAsync(int pageIdx, int pageSize, DateTime? begindateTime, DateTime? enddatetime);

        Task<List<CarShopInfo>> GetLoadCarAllInfoPagedListAsync(int pageIdx, int pageSize, long? carUserId, CarStatus? carStatus, DateTime? begindateTime, DateTime? enddatetime, int orderBy = 0);


        Task<IPagedList<LoadCarOutputDto>> GetAllLoadingInvoiceAsync(int pageIdx, int pageSize, LoadInvoiceFilter filter = null);

        Task<LoadCarOutputDto> GetLoadingInvoiceAsync(Guid id);


        Task<IPagedList<LoadCarDetailsOutputDto>> GetLoadDetailsAsync(int pageIdx, int pageSize, LoadDetailsFilter filter = null);

        /// <summary>
        /// 获取装车的配送信息
        /// </summary>
        /// <param name="restaurantId"></param>
        /// <returns></returns>
        Task<List<DistributionDto>> GetDistributionDetails(Guid restaurantId);

        /// <summary>
        /// 修改配送信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task EditDistribution(List<EditDistributionInpuDto> input);
    }
}
